@agentsgot/agent-kit 0.0.0-stage → 1.0.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/ARCHITECTURE.md +5 -0
- package/README.md +13 -2
- package/dist/a2a.d.ts +35 -0
- package/dist/a2a.d.ts.map +1 -0
- package/dist/a2a.js +109 -0
- package/dist/a2a.js.map +1 -0
- package/dist/cli/binding.d.ts +24 -0
- package/dist/cli/binding.d.ts.map +1 -0
- package/dist/cli/binding.js +52 -0
- package/dist/cli/binding.js.map +1 -0
- package/dist/cli/commands.d.ts +18 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +191 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/context.d.ts +61 -0
- package/dist/cli/context.d.ts.map +1 -0
- package/dist/cli/context.js +147 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/doctor.d.ts +34 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +109 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/home.d.ts +37 -0
- package/dist/cli/home.d.ts.map +1 -0
- package/dist/cli/home.js +77 -0
- package/dist/cli/home.js.map +1 -0
- package/dist/cli/index.d.ts +5 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +120 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/install.d.ts +19 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +64 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/cli/keystore.d.ts +25 -0
- package/dist/cli/keystore.d.ts.map +1 -0
- package/dist/cli/keystore.js +57 -0
- package/dist/cli/keystore.js.map +1 -0
- package/dist/cli/mcp.d.ts +7 -0
- package/dist/cli/mcp.d.ts.map +1 -0
- package/dist/cli/mcp.js +28 -0
- package/dist/cli/mcp.js.map +1 -0
- package/dist/cli/prompt.d.ts +10 -0
- package/dist/cli/prompt.d.ts.map +1 -0
- package/dist/cli/prompt.js +71 -0
- package/dist/cli/prompt.js.map +1 -0
- package/dist/cli/reports.d.ts +42 -0
- package/dist/cli/reports.d.ts.map +1 -0
- package/dist/cli/reports.js +121 -0
- package/dist/cli/reports.js.map +1 -0
- package/dist/cli/run.d.ts +21 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +125 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/wallet.d.ts +19 -0
- package/dist/cli/wallet.d.ts.map +1 -0
- package/dist/cli/wallet.js +58 -0
- package/dist/cli/wallet.js.map +1 -0
- package/dist/guides.d.ts +7 -0
- package/dist/guides.d.ts.map +1 -0
- package/dist/guides.js +94 -0
- package/dist/guides.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/llm.d.ts +16 -0
- package/dist/llm.d.ts.map +1 -0
- package/dist/llm.js +30 -0
- package/dist/llm.js.map +1 -0
- package/dist/mcp/cli.d.ts +3 -0
- package/dist/mcp/cli.d.ts.map +1 -0
- package/dist/mcp/cli.js +6 -0
- package/dist/mcp/cli.js.map +1 -0
- package/dist/mcp/server.d.ts +38 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +693 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/ports.d.ts +123 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +134 -0
- package/dist/ports.js.map +1 -0
- package/dist/roles.d.ts +16 -0
- package/dist/roles.d.ts.map +1 -0
- package/dist/roles.js +49 -0
- package/dist/roles.js.map +1 -0
- package/dist/runner.d.ts +126 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +292 -0
- package/dist/runner.js.map +1 -0
- package/dist/schedules.d.ts +34 -0
- package/dist/schedules.d.ts.map +1 -0
- package/dist/schedules.js +116 -0
- package/dist/schedules.js.map +1 -0
- package/dist/sdk/base64.d.ts +4 -0
- package/dist/sdk/base64.d.ts.map +1 -0
- package/dist/sdk/base64.js +15 -0
- package/dist/sdk/base64.js.map +1 -0
- package/dist/sdk/client.d.ts +198 -0
- package/dist/sdk/client.d.ts.map +1 -0
- package/dist/sdk/client.js +413 -0
- package/dist/sdk/client.js.map +1 -0
- package/dist/security.d.ts +10 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +24 -0
- package/dist/security.js.map +1 -0
- package/dist/skills.d.ts +21 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +93 -0
- package/dist/skills.js.map +1 -0
- package/dist/workers.d.ts +64 -0
- package/dist/workers.d.ts.map +1 -0
- package/dist/workers.js +127 -0
- package/dist/workers.js.map +1 -0
- package/dist/zip.d.ts +8 -0
- package/dist/zip.d.ts.map +1 -0
- package/dist/zip.js +80 -0
- package/dist/zip.js.map +1 -0
- package/docs/README.md +25 -0
- package/docs/architecture.md +18 -0
- package/docs/deployment.md +26 -0
- package/docs/reference/01-RULES.md +822 -0
- package/docs/reference/02-INTERFACES.md +487 -0
- package/docs/reference/03-STAKING-PENALTY-SPEC.md +739 -0
- package/docs/updates.md +61 -0
- package/docs/verification.md +72 -0
- package/package.json +87 -4
- package/skills/dist/agent-skills.json +68 -0
- package/skills/dist/arbitrator/SKILL.md +186 -0
- package/skills/dist/executor/SKILL.md +219 -0
- package/skills/dist/publisher/SKILL.md +172 -0
- package/skills/dist/tester/SKILL.md +198 -0
- package/vendor/shared/ARCHITECTURE.md +97 -0
- package/vendor/shared/README.md +5 -0
- package/vendor/shared/abi/index.js +2 -0
- package/vendor/shared/abi/index.ts +2 -0
- package/vendor/shared/abi/protocol/AgentRegistry.js +1623 -0
- package/vendor/shared/abi/protocol/AgentRegistry.json +1623 -0
- package/vendor/shared/abi/protocol/AgentRegistry.ts +1623 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.js +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.json +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCaseProofVerifier.ts +154 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.js +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.json +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationCourt.ts +1550 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.js +509 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.json +509 -0
- package/vendor/shared/abi/protocol/ArbitrationPool.ts +509 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.js +44 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.json +44 -0
- package/vendor/shared/abi/protocol/ArbitrationProgressor.ts +44 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.js +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.json +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSelection.ts +1153 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.js +956 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.json +956 -0
- package/vendor/shared/abi/protocol/ArbitrationSettlement.ts +956 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.js +964 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.json +964 -0
- package/vendor/shared/abi/protocol/ArbitrationStream.ts +964 -0
- package/vendor/shared/abi/protocol/EmissionController.js +1436 -0
- package/vendor/shared/abi/protocol/EmissionController.json +1436 -0
- package/vendor/shared/abi/protocol/EmissionController.ts +1436 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.js +611 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.json +611 -0
- package/vendor/shared/abi/protocol/HourlyAnchor.ts +611 -0
- package/vendor/shared/abi/protocol/IncentiveVault.js +480 -0
- package/vendor/shared/abi/protocol/IncentiveVault.json +480 -0
- package/vendor/shared/abi/protocol/IncentiveVault.ts +480 -0
- package/vendor/shared/abi/protocol/ParamRegistry.js +814 -0
- package/vendor/shared/abi/protocol/ParamRegistry.json +814 -0
- package/vendor/shared/abi/protocol/ParamRegistry.ts +814 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.js +553 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.json +553 -0
- package/vendor/shared/abi/protocol/PlatformTreasury.ts +553 -0
- package/vendor/shared/abi/protocol/ProtocolProof.js +1171 -0
- package/vendor/shared/abi/protocol/ProtocolProof.json +1171 -0
- package/vendor/shared/abi/protocol/ProtocolProof.ts +1171 -0
- package/vendor/shared/abi/protocol/PublisherStaking.js +1227 -0
- package/vendor/shared/abi/protocol/PublisherStaking.json +1227 -0
- package/vendor/shared/abi/protocol/PublisherStaking.ts +1227 -0
- package/vendor/shared/abi/protocol/RewardVesting.js +1027 -0
- package/vendor/shared/abi/protocol/RewardVesting.json +1027 -0
- package/vendor/shared/abi/protocol/RewardVesting.ts +1027 -0
- package/vendor/shared/abi/protocol/TaskEscrow.js +2219 -0
- package/vendor/shared/abi/protocol/TaskEscrow.json +2219 -0
- package/vendor/shared/abi/protocol/TaskEscrow.ts +2219 -0
- package/vendor/shared/abi/protocol/TesterAssignment.js +1375 -0
- package/vendor/shared/abi/protocol/TesterAssignment.json +1375 -0
- package/vendor/shared/abi/protocol/TesterAssignment.ts +1375 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.js +1614 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.json +1614 -0
- package/vendor/shared/abi/protocol/ValidatorStaking.ts +1614 -0
- package/vendor/shared/abi/protocol/index.js +19 -0
- package/vendor/shared/abi/protocol/index.ts +19 -0
- package/vendor/shared/abi/token/AGTToken.js +1018 -0
- package/vendor/shared/abi/token/AGTToken.json +1018 -0
- package/vendor/shared/abi/token/AGTToken.ts +1018 -0
- package/vendor/shared/abi/token/GenesisDistributor.js +242 -0
- package/vendor/shared/abi/token/GenesisDistributor.json +242 -0
- package/vendor/shared/abi/token/GenesisDistributor.ts +242 -0
- package/vendor/shared/abi/token/LPLocker.js +21 -0
- package/vendor/shared/abi/token/LPLocker.json +21 -0
- package/vendor/shared/abi/token/LPLocker.ts +21 -0
- package/vendor/shared/abi/token/LaunchLiquidity.js +335 -0
- package/vendor/shared/abi/token/LaunchLiquidity.json +335 -0
- package/vendor/shared/abi/token/LaunchLiquidity.ts +335 -0
- package/vendor/shared/abi/token/LiquidityAdder.js +228 -0
- package/vendor/shared/abi/token/LiquidityAdder.json +228 -0
- package/vendor/shared/abi/token/LiquidityAdder.ts +228 -0
- package/vendor/shared/abi/token/TaxDistributor.js +235 -0
- package/vendor/shared/abi/token/TaxDistributor.json +235 -0
- package/vendor/shared/abi/token/TaxDistributor.ts +235 -0
- package/vendor/shared/abi/token/TestFaucet.js +214 -0
- package/vendor/shared/abi/token/TestFaucet.json +214 -0
- package/vendor/shared/abi/token/TestFaucet.ts +214 -0
- package/vendor/shared/abi/token/index.js +7 -0
- package/vendor/shared/abi/token/index.ts +7 -0
- package/vendor/shared/dist/abi/index.d.ts +3 -0
- package/vendor/shared/dist/abi/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/index.js +3 -0
- package/vendor/shared/dist/abi/index.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.d.ts +1249 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.js +1624 -0
- package/vendor/shared/dist/abi/protocol/AgentRegistry.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.d.ts +119 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.js +155 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCaseProofVerifier.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.d.ts +1205 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.js +1551 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationCourt.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.d.ts +391 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.js +510 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationPool.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.d.ts +34 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.js +45 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationProgressor.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.d.ts +885 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.js +1154 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSelection.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.d.ts +742 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.js +957 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationSettlement.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.d.ts +741 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.js +965 -0
- package/vendor/shared/dist/abi/protocol/ArbitrationStream.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.d.ts +1110 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.js +1437 -0
- package/vendor/shared/dist/abi/protocol/EmissionController.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.d.ts +467 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.js +612 -0
- package/vendor/shared/dist/abi/protocol/HourlyAnchor.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.d.ts +369 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.js +481 -0
- package/vendor/shared/dist/abi/protocol/IncentiveVault.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.d.ts +628 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.js +815 -0
- package/vendor/shared/dist/abi/protocol/ParamRegistry.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.d.ts +426 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.js +554 -0
- package/vendor/shared/dist/abi/protocol/PlatformTreasury.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.d.ts +903 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.js +1172 -0
- package/vendor/shared/dist/abi/protocol/ProtocolProof.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.d.ts +947 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.js +1228 -0
- package/vendor/shared/dist/abi/protocol/PublisherStaking.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.d.ts +793 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.js +1028 -0
- package/vendor/shared/dist/abi/protocol/RewardVesting.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.d.ts +1725 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.js +2220 -0
- package/vendor/shared/dist/abi/protocol/TaskEscrow.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.d.ts +1058 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.js +1376 -0
- package/vendor/shared/dist/abi/protocol/TesterAssignment.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.d.ts +1236 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.js +1615 -0
- package/vendor/shared/dist/abi/protocol/ValidatorStaking.js.map +1 -0
- package/vendor/shared/dist/abi/protocol/index.d.ts +20 -0
- package/vendor/shared/dist/abi/protocol/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/protocol/index.js +20 -0
- package/vendor/shared/dist/abi/protocol/index.js.map +1 -0
- package/vendor/shared/dist/abi/token/AGTToken.d.ts +786 -0
- package/vendor/shared/dist/abi/token/AGTToken.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/AGTToken.js +1019 -0
- package/vendor/shared/dist/abi/token/AGTToken.js.map +1 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.d.ts +187 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.js +243 -0
- package/vendor/shared/dist/abi/token/GenesisDistributor.js.map +1 -0
- package/vendor/shared/dist/abi/token/LPLocker.d.ts +16 -0
- package/vendor/shared/dist/abi/token/LPLocker.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LPLocker.js +22 -0
- package/vendor/shared/dist/abi/token/LPLocker.js.map +1 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.d.ts +260 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.js +336 -0
- package/vendor/shared/dist/abi/token/LaunchLiquidity.js.map +1 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.d.ts +176 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.js +229 -0
- package/vendor/shared/dist/abi/token/LiquidityAdder.js.map +1 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.d.ts +182 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.js +236 -0
- package/vendor/shared/dist/abi/token/TaxDistributor.js.map +1 -0
- package/vendor/shared/dist/abi/token/TestFaucet.d.ts +164 -0
- package/vendor/shared/dist/abi/token/TestFaucet.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/TestFaucet.js +215 -0
- package/vendor/shared/dist/abi/token/TestFaucet.js.map +1 -0
- package/vendor/shared/dist/abi/token/index.d.ts +8 -0
- package/vendor/shared/dist/abi/token/index.d.ts.map +1 -0
- package/vendor/shared/dist/abi/token/index.js +8 -0
- package/vendor/shared/dist/abi/token/index.js.map +1 -0
- package/vendor/shared/dist/emission-schedule.d.ts +51 -0
- package/vendor/shared/dist/emission-schedule.d.ts.map +1 -0
- package/vendor/shared/dist/emission-schedule.js +116 -0
- package/vendor/shared/dist/emission-schedule.js.map +1 -0
- package/vendor/shared/dist/index.d.ts +7 -0
- package/vendor/shared/dist/index.d.ts.map +1 -0
- package/vendor/shared/dist/index.js +7 -0
- package/vendor/shared/dist/index.js.map +1 -0
- package/vendor/shared/dist/params/index.d.ts +6 -0
- package/vendor/shared/dist/params/index.d.ts.map +1 -0
- package/vendor/shared/dist/params/index.js +84 -0
- package/vendor/shared/dist/params/index.js.map +1 -0
- package/vendor/shared/dist/protocol-proofs.d.ts +267 -0
- package/vendor/shared/dist/protocol-proofs.d.ts.map +1 -0
- package/vendor/shared/dist/protocol-proofs.js +205 -0
- package/vendor/shared/dist/protocol-proofs.js.map +1 -0
- package/vendor/shared/dist/rules/index.d.ts +204 -0
- package/vendor/shared/dist/rules/index.d.ts.map +1 -0
- package/vendor/shared/dist/rules/index.js +802 -0
- package/vendor/shared/dist/rules/index.js.map +1 -0
- package/vendor/shared/dist/rules/spec-content.d.ts +21 -0
- package/vendor/shared/dist/rules/spec-content.d.ts.map +1 -0
- package/vendor/shared/dist/rules/spec-content.js +90 -0
- package/vendor/shared/dist/rules/spec-content.js.map +1 -0
- package/vendor/shared/dist/rules/task-risk.d.ts +35 -0
- package/vendor/shared/dist/rules/task-risk.d.ts.map +1 -0
- package/vendor/shared/dist/rules/task-risk.js +438 -0
- package/vendor/shared/dist/rules/task-risk.js.map +1 -0
- package/vendor/shared/dist/schemas/domain.d.ts +195 -0
- package/vendor/shared/dist/schemas/domain.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/domain.js +158 -0
- package/vendor/shared/dist/schemas/domain.js.map +1 -0
- package/vendor/shared/dist/schemas/draft.d.ts +730 -0
- package/vendor/shared/dist/schemas/draft.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/draft.js +110 -0
- package/vendor/shared/dist/schemas/draft.js.map +1 -0
- package/vendor/shared/dist/schemas/enums.d.ts +130 -0
- package/vendor/shared/dist/schemas/enums.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/enums.js +63 -0
- package/vendor/shared/dist/schemas/enums.js.map +1 -0
- package/vendor/shared/dist/schemas/index.d.ts +4 -0
- package/vendor/shared/dist/schemas/index.d.ts.map +1 -0
- package/vendor/shared/dist/schemas/index.js +4 -0
- package/vendor/shared/dist/schemas/index.js.map +1 -0
- package/vendor/shared/dist/units.d.ts +10 -0
- package/vendor/shared/dist/units.d.ts.map +1 -0
- package/vendor/shared/dist/units.js +44 -0
- package/vendor/shared/dist/units.js.map +1 -0
- package/vendor/shared/openapi.json +78754 -0
- package/vendor/shared/package.json +43 -0
- package/vendor/shared/params/params.json +152 -0
- package/vendor/shared/params/ranges.json +574 -0
- package/vendor/shared/src/emission-schedule.ts +151 -0
- package/vendor/shared/src/index.ts +6 -0
- package/vendor/shared/src/params/index.ts +139 -0
- package/vendor/shared/src/protocol-proofs.ts +235 -0
- package/vendor/shared/src/rules/index.ts +1081 -0
- package/vendor/shared/src/rules/spec-content.ts +120 -0
- package/vendor/shared/src/rules/task-risk.ts +550 -0
- package/vendor/shared/src/schemas/domain.ts +187 -0
- package/vendor/shared/src/schemas/draft.ts +141 -0
- package/vendor/shared/src/schemas/enums.ts +73 -0
- package/vendor/shared/src/schemas/index.ts +3 -0
- package/vendor/shared/src/units.ts +43 -0
- package/vendor/shared/test/emission-schedule.test.ts +115 -0
- package/vendor/shared/test/fixtures/emission-vectors.json +1055 -0
- package/vendor/shared/test/fixtures.ts +65 -0
- package/vendor/shared/test/params.test.ts +48 -0
- package/vendor/shared/test/properties.test.ts +136 -0
- package/vendor/shared/test/protocol-proofs.test.ts +88 -0
- package/vendor/shared/test/rules.test.ts +474 -0
- package/vendor/shared/test/schemas.test.ts +130 -0
- package/vendor/shared/test/task-risk.test.ts +489 -0
- package/vendor/shared/tsconfig.abi.json +11 -0
- package/vendor/shared/tsconfig.json +23 -0
- package/vendor/shared/types/api/index.d.ts +303 -0
- package/vendor/shared/vitest.config.ts +8 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { writePrivate } from "./home.js";
|
|
6
|
+
export const TARGETS = ["cursor", "claude", "codex"];
|
|
7
|
+
export function isTarget(value) {
|
|
8
|
+
return TARGETS.includes(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Skill directory per host. `--global` installs into the user's home, otherwise into the
|
|
12
|
+
* current project. Codex reads AGENTS.md-style skills from ~/.codex/skills.
|
|
13
|
+
*/
|
|
14
|
+
export function skillDir(target, role, options) {
|
|
15
|
+
const base = options.global ? homedir() : resolve(options.cwd ?? process.cwd());
|
|
16
|
+
const folder = `agentsgot-${role}`;
|
|
17
|
+
switch (target) {
|
|
18
|
+
case "cursor":
|
|
19
|
+
return join(base, ".cursor", "skills", folder);
|
|
20
|
+
case "claude":
|
|
21
|
+
return join(base, ".claude", "skills", folder);
|
|
22
|
+
case "codex":
|
|
23
|
+
return join(options.global ? base : base, ".codex", "skills", folder);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/** Rendered SKILL.md shipped inside the npm package (skills/dist/<role>/SKILL.md). */
|
|
27
|
+
export function bundledSkill(role) {
|
|
28
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
29
|
+
for (const candidate of [
|
|
30
|
+
join(here, "../../skills/dist", role, "SKILL.md"),
|
|
31
|
+
join(here, "../../../skills/dist", role, "SKILL.md"),
|
|
32
|
+
])
|
|
33
|
+
if (existsSync(candidate))
|
|
34
|
+
return readFileSync(candidate, "utf8");
|
|
35
|
+
throw new Error(`Bundled skill for ${role} not found; reinstall @agentsgot/agent-kit.`);
|
|
36
|
+
}
|
|
37
|
+
export async function fetchSkill(origin, role, fetcher = fetch) {
|
|
38
|
+
const response = await fetcher(`${origin.replace(/\/+$/u, "")}/skills/${role}/SKILL.md`);
|
|
39
|
+
if (!response.ok)
|
|
40
|
+
throw new Error(`Skill download failed: HTTP ${response.status}`);
|
|
41
|
+
return response.text();
|
|
42
|
+
}
|
|
43
|
+
export function installSkill(markdown, dir) {
|
|
44
|
+
const path = join(dir, "SKILL.md");
|
|
45
|
+
writePrivate(path, markdown);
|
|
46
|
+
return path;
|
|
47
|
+
}
|
|
48
|
+
/** MCP server snippet for the host config, printed after install. */
|
|
49
|
+
export function mcpSnippet(target) {
|
|
50
|
+
const server = {
|
|
51
|
+
command: "npx",
|
|
52
|
+
args: ["-y", "@agentsgot/agent-kit", "mcp"],
|
|
53
|
+
env: { AGENTSGOT_API_BASE_URL: "https://agentsgot.network/api" },
|
|
54
|
+
};
|
|
55
|
+
if (target === "codex")
|
|
56
|
+
return [
|
|
57
|
+
"[mcp_servers.agentsgot]",
|
|
58
|
+
`command = "npx"`,
|
|
59
|
+
`args = ["-y", "@agentsgot/agent-kit", "mcp"]`,
|
|
60
|
+
`env = { AGENTSGOT_API_BASE_URL = "${server.env.AGENTSGOT_API_BASE_URL}" }`,
|
|
61
|
+
].join("\n");
|
|
62
|
+
return JSON.stringify({ mcpServers: { agentsgot: server } }, null, 2);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/cli/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAC;AAG9D,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,OAAQ,OAA6B,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,MAAc,EAAE,IAAU,EAAE,OAA2C;IAC9F,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAChF,MAAM,MAAM,GAAG,aAAa,IAAI,EAA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OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAgB,EAAE,GAAW;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACnC,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,MAAM,MAAM,GAAG;QACb,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,CAAC,IAAI,EAAE,sBAAsB,EAAE,KAAK,CAAC;QAC3C,GAAG,EAAE,EAAE,sBAAsB,EAAE,+BAA+B,EAAE;KACjE,CAAC;IACF,IAAI,MAAM,KAAK,OAAO;QACpB,OAAO;YACL,yBAAyB;YACzB,iBAAiB;YACjB,8CAA8C;YAC9C,qCAAqC,MAAM,CAAC,GAAG,CAAC,sBAAsB,KAAK;SAC5E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Ethereum V3 keystore (scrypt + aes-128-ctr), compatible with geth / MetaMask / ethers. */
|
|
2
|
+
export interface KeystoreV3 {
|
|
3
|
+
version: 3;
|
|
4
|
+
id: string;
|
|
5
|
+
address: string;
|
|
6
|
+
crypto: {
|
|
7
|
+
cipher: "aes-128-ctr";
|
|
8
|
+
cipherparams: {
|
|
9
|
+
iv: string;
|
|
10
|
+
};
|
|
11
|
+
ciphertext: string;
|
|
12
|
+
kdf: "scrypt";
|
|
13
|
+
kdfparams: {
|
|
14
|
+
dklen: number;
|
|
15
|
+
salt: string;
|
|
16
|
+
n: number;
|
|
17
|
+
r: number;
|
|
18
|
+
p: number;
|
|
19
|
+
};
|
|
20
|
+
mac: string;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function encryptKeystore(privateKey: `0x${string}`, password: string): KeystoreV3;
|
|
24
|
+
export declare function decryptKeystore(keystore: KeystoreV3, password: string): `0x${string}`;
|
|
25
|
+
//# sourceMappingURL=keystore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keystore.d.ts","sourceRoot":"","sources":["../../src/cli/keystore.ts"],"names":[],"mappings":"AAIA,6FAA6F;AAC7F,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,CAAC,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE;QACN,MAAM,EAAE,aAAa,CAAC;QACtB,YAAY,EAAE;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7B,UAAU,EAAE,MAAM,CAAC;QACnB,GAAG,EAAE,QAAQ,CAAC;QACd,SAAS,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5E,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAoBD,wBAAgB,eAAe,CAAC,UAAU,EAAE,KAAK,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAuBvF;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAgBrF"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createCipheriv, createDecipheriv, randomBytes, randomUUID, scryptSync } from "node:crypto";
|
|
2
|
+
import { bytesToHex, hexToBytes, keccak256 } from "viem";
|
|
3
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
4
|
+
const N = 1 << 17;
|
|
5
|
+
const R = 8;
|
|
6
|
+
const P = 1;
|
|
7
|
+
const DKLEN = 32;
|
|
8
|
+
function derive(password, salt, n, r, p, dklen) {
|
|
9
|
+
return scryptSync(password.normalize("NFKC"), salt, dklen, {
|
|
10
|
+
N: n,
|
|
11
|
+
r,
|
|
12
|
+
p,
|
|
13
|
+
maxmem: 256 * n * r + 1024 * 1024,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function mac(derived, ciphertext) {
|
|
17
|
+
return keccak256(new Uint8Array(Buffer.concat([derived.subarray(16, 32), ciphertext]))).slice(2);
|
|
18
|
+
}
|
|
19
|
+
export function encryptKeystore(privateKey, password) {
|
|
20
|
+
if (password.length < 8)
|
|
21
|
+
throw new Error("Keystore password must have at least 8 characters.");
|
|
22
|
+
const salt = randomBytes(32);
|
|
23
|
+
const iv = randomBytes(16);
|
|
24
|
+
const derived = derive(password, salt, N, R, P, DKLEN);
|
|
25
|
+
const cipher = createCipheriv("aes-128-ctr", derived.subarray(0, 16), iv);
|
|
26
|
+
const ciphertext = Buffer.concat([
|
|
27
|
+
cipher.update(Buffer.from(hexToBytes(privateKey))),
|
|
28
|
+
cipher.final(),
|
|
29
|
+
]);
|
|
30
|
+
return {
|
|
31
|
+
version: 3,
|
|
32
|
+
id: randomUUID(),
|
|
33
|
+
address: privateKeyToAccount(privateKey).address.slice(2).toLowerCase(),
|
|
34
|
+
crypto: {
|
|
35
|
+
cipher: "aes-128-ctr",
|
|
36
|
+
cipherparams: { iv: iv.toString("hex") },
|
|
37
|
+
ciphertext: ciphertext.toString("hex"),
|
|
38
|
+
kdf: "scrypt",
|
|
39
|
+
kdfparams: { dklen: DKLEN, salt: salt.toString("hex"), n: N, r: R, p: P },
|
|
40
|
+
mac: mac(derived, ciphertext),
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export function decryptKeystore(keystore, password) {
|
|
45
|
+
const { crypto } = keystore;
|
|
46
|
+
if (crypto.kdf !== "scrypt" || crypto.cipher !== "aes-128-ctr")
|
|
47
|
+
throw new Error("Unsupported keystore: only scrypt + aes-128-ctr V3 keystores are supported.");
|
|
48
|
+
const { salt, n, r, p, dklen } = crypto.kdfparams;
|
|
49
|
+
const derived = derive(password, Buffer.from(salt, "hex"), n, r, p, dklen);
|
|
50
|
+
const ciphertext = Buffer.from(crypto.ciphertext, "hex");
|
|
51
|
+
if (mac(derived, ciphertext) !== crypto.mac.toLowerCase())
|
|
52
|
+
throw new Error("Wrong keystore password.");
|
|
53
|
+
const decipher = createDecipheriv("aes-128-ctr", derived.subarray(0, 16), Buffer.from(crypto.cipherparams.iv, "hex"));
|
|
54
|
+
const key = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
|
|
55
|
+
return bytesToHex(new Uint8Array(key));
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=keystore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keystore.js","sourceRoot":"","sources":["../../src/cli/keystore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAiBpD,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;AAClB,MAAM,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,CAAC,GAAG,CAAC,CAAC;AACZ,MAAM,KAAK,GAAG,EAAE,CAAC;AAEjB,SAAS,MAAM,CAAC,QAAgB,EAAE,IAAY,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC5F,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAA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AgB,CAC/B,aAAa,EACb,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,EACvB,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAC3C,CAAC;IACF,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAC3E,OAAO,UAAU,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type CliContext } from "./context.js";
|
|
2
|
+
/**
|
|
3
|
+
* `agentsgot mcp`: stdio MCP server. stdout carries JSON-RPC only, so the keystore password
|
|
4
|
+
* must come from AGENTSGOT_KEYSTORE_PASSWORD (or use AGENTSGOT_WALLET_PRIVATE_KEY).
|
|
5
|
+
*/
|
|
6
|
+
export declare function mcpCommand(ctx: CliContext): Promise<void>;
|
|
7
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/cli/mcp.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,cAAc,CAAC;AAapF;;;GAGG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAS/D"}
|
package/dist/cli/mcp.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { AgentGridMcpServer, serveStdio } from "../mcp/server.js";
|
|
2
|
+
import { clientFor, loadAccount, siweMessage } from "./context.js";
|
|
3
|
+
async function* lines(chunks) {
|
|
4
|
+
let pending = "";
|
|
5
|
+
for await (const chunk of chunks) {
|
|
6
|
+
pending += chunk;
|
|
7
|
+
const parts = pending.split(/\r?\n/u);
|
|
8
|
+
pending = parts.pop() ?? "";
|
|
9
|
+
yield* parts;
|
|
10
|
+
}
|
|
11
|
+
if (pending)
|
|
12
|
+
yield pending;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `agentsgot mcp`: stdio MCP server. stdout carries JSON-RPC only, so the keystore password
|
|
16
|
+
* must come from AGENTSGOT_KEYSTORE_PASSWORD (or use AGENTSGOT_WALLET_PRIVATE_KEY).
|
|
17
|
+
*/
|
|
18
|
+
export async function mcpCommand(ctx) {
|
|
19
|
+
const account = await loadAccount(ctx);
|
|
20
|
+
const { client } = await clientFor(ctx, account);
|
|
21
|
+
process.stdin.setEncoding("utf8");
|
|
22
|
+
const walletSession = () => client.signInAsWallet(siweMessage(ctx, account.address));
|
|
23
|
+
await serveStdio(new AgentGridMcpServer(client, { walletSession }), {
|
|
24
|
+
lines: lines(process.stdin),
|
|
25
|
+
write: (value) => process.stdout.write(value),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../src/cli/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAmB,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEpF,KAAK,SAAS,CAAC,CAAC,KAAK,CAAC,MAA6B;IACjD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACjC,OAAO,IAAI,KAAK,CAAC;QACjB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACtC,OAAO,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAC5B,KAAK,CAAC,CAAC,KAAK,CAAC;IACf,CAAC;IACD,IAAI,OAAO;QAAE,MAAM,OAAO,CAAC;AAC7B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAe;IAC9C,MAAM,OAAO,GAAG,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACrF,MAAM,UAAU,CAAC,IAAI,kBAAkB,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;QAClE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAA8B,CAAC;QACpD,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** `1` uses the current wallet. `2` stops so the user can create one. A non-interactive shell uses the current wallet. */
|
|
2
|
+
export declare function chooseWallet(question: string): Promise<"current" | "new">;
|
|
3
|
+
/** Yes keeps the proposed change. A non-interactive shell keeps the saved binding. */
|
|
4
|
+
export declare function confirm(question: string): Promise<boolean>;
|
|
5
|
+
/** Ask a question on the user's own terminal. */
|
|
6
|
+
export declare function ask(question: string): Promise<string>;
|
|
7
|
+
/** Read a password without echo; requires an interactive terminal. */
|
|
8
|
+
export declare function askHidden(question: string): Promise<string>;
|
|
9
|
+
export declare const SAFETY_NOTICE = "Please do not paste a private key or mnemonic into a chat window. Neither the platform nor any agent will ever ask for them.";
|
|
10
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/cli/prompt.ts"],"names":[],"mappings":"AAEA,0HAA0H;AAC1H,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,KAAK,CAAC,CAQ/E;AAED,sFAAsF;AACtF,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOhE;AAED,iDAAiD;AACjD,wBAAsB,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO3D;AAED,sEAAsE;AACtE,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkCjE;AAED,eAAO,MAAM,aAAa,iIACsG,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { createInterface } from "node:readline";
|
|
2
|
+
/** `1` uses the current wallet. `2` stops so the user can create one. A non-interactive shell uses the current wallet. */
|
|
3
|
+
export async function chooseWallet(question) {
|
|
4
|
+
if (!process.stdin.isTTY) {
|
|
5
|
+
process.stderr.write(`${question}\nNo interactive terminal; using the current wallet.\n`);
|
|
6
|
+
return "current";
|
|
7
|
+
}
|
|
8
|
+
const answer = (await ask(question)).trim().toLowerCase();
|
|
9
|
+
if (answer === "2" || answer === "new")
|
|
10
|
+
return "new";
|
|
11
|
+
return "current";
|
|
12
|
+
}
|
|
13
|
+
/** Yes keeps the proposed change. A non-interactive shell keeps the saved binding. */
|
|
14
|
+
export async function confirm(question) {
|
|
15
|
+
if (!process.stdin.isTTY) {
|
|
16
|
+
process.stderr.write(`${question}\nNo interactive terminal; keeping the saved API key.\n`);
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const answer = (await ask(question)).trim().toLowerCase();
|
|
20
|
+
return answer === "y" || answer === "yes";
|
|
21
|
+
}
|
|
22
|
+
/** Ask a question on the user's own terminal. */
|
|
23
|
+
export async function ask(question) {
|
|
24
|
+
const rl = createInterface({ input: process.stdin, output: process.stderr, terminal: true });
|
|
25
|
+
try {
|
|
26
|
+
return await new Promise((resolve) => rl.question(question, resolve));
|
|
27
|
+
}
|
|
28
|
+
finally {
|
|
29
|
+
rl.close();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Read a password without echo; requires an interactive terminal. */
|
|
33
|
+
export async function askHidden(question) {
|
|
34
|
+
const stdin = process.stdin;
|
|
35
|
+
if (!stdin.isTTY)
|
|
36
|
+
throw new Error("A password prompt needs an interactive terminal. Run this command yourself.");
|
|
37
|
+
process.stderr.write(question);
|
|
38
|
+
stdin.setRawMode(true);
|
|
39
|
+
stdin.resume();
|
|
40
|
+
stdin.setEncoding("utf8");
|
|
41
|
+
let value = "";
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const onData = (chunk) => {
|
|
44
|
+
for (const char of chunk) {
|
|
45
|
+
if (char === "\r" || char === "\n") {
|
|
46
|
+
cleanup();
|
|
47
|
+
process.stderr.write("\n");
|
|
48
|
+
resolve(value);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (char === "\u0003") {
|
|
52
|
+
cleanup();
|
|
53
|
+
reject(new Error("Cancelled."));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (char === "\u007f" || char === "\b")
|
|
57
|
+
value = value.slice(0, -1);
|
|
58
|
+
else
|
|
59
|
+
value += char;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const cleanup = () => {
|
|
63
|
+
stdin.off("data", onData);
|
|
64
|
+
stdin.setRawMode(false);
|
|
65
|
+
stdin.pause();
|
|
66
|
+
};
|
|
67
|
+
stdin.on("data", onData);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
export const SAFETY_NOTICE = "Please do not paste a private key or mnemonic into a chat window. Neither the platform nor any agent will ever ask for them.";
|
|
71
|
+
//# sourceMappingURL=prompt.js.map
|
|
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AI,IAAI,KAAK,IAAI;oBAAE,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;;oBAC9D,KAAK,IAAI,IAAI,CAAC;YACrB,CAAC;QACH,CAAC,CAAC;QACF,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC1B,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;YACxB,KAAK,CAAC,KAAK,EAAE,CAAC;QAChB,CAAC,CAAC;QACF,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GACxB,8HAA8H,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { RunnerEvent, TickReport } from "../runner.js";
|
|
2
|
+
/** Remove anything that looks like key material before it reaches a file, webhook or chat. */
|
|
3
|
+
export declare function sanitize(text: string): string;
|
|
4
|
+
export interface ReportSummary {
|
|
5
|
+
role: string;
|
|
6
|
+
at: string;
|
|
7
|
+
online: boolean;
|
|
8
|
+
lastHeartbeatAt: string | null;
|
|
9
|
+
counts: {
|
|
10
|
+
claims: number;
|
|
11
|
+
deliveries: number;
|
|
12
|
+
testReports: number;
|
|
13
|
+
votes: number;
|
|
14
|
+
};
|
|
15
|
+
inProgress: {
|
|
16
|
+
item: string;
|
|
17
|
+
deadline: string | null;
|
|
18
|
+
}[];
|
|
19
|
+
waitingForUser: string[];
|
|
20
|
+
earnings: {
|
|
21
|
+
claimedAgt: string;
|
|
22
|
+
claimableAgt: string;
|
|
23
|
+
lockedAgt: string;
|
|
24
|
+
};
|
|
25
|
+
risks: string[];
|
|
26
|
+
nextReportAt: string;
|
|
27
|
+
}
|
|
28
|
+
/** Fold the tick reports of one period into a summary. */
|
|
29
|
+
export declare function summarize(role: string, ticks: readonly TickReport[], extra: Pick<ReportSummary, "online" | "lastHeartbeatAt" | "earnings" | "nextReportAt">): ReportSummary;
|
|
30
|
+
export declare function formatReport(summary: ReportSummary): string;
|
|
31
|
+
/** Append to <dir>/<role>-YYYYMMDD.md and .jsonl; returns the .md path. */
|
|
32
|
+
export declare function writeReport(dir: string, summary: ReportSummary): string;
|
|
33
|
+
/** Immediate event line (drawn as tester, deadline warning, tx failed, ...). */
|
|
34
|
+
export declare function writeEvent(dir: string, role: string, event: RunnerEvent): void;
|
|
35
|
+
/** Read summaries and events newer than `sinceMs` for `agentsgot report`. */
|
|
36
|
+
export declare function readReports(dir: string, sinceMs: number, role?: string): {
|
|
37
|
+
at: string;
|
|
38
|
+
}[];
|
|
39
|
+
export declare function postWebhook(url: string, text: string, fetcher?: typeof fetch): Promise<void>;
|
|
40
|
+
/** Parse "24h", "30m", "7d", "90s" into milliseconds. */
|
|
41
|
+
export declare function parseDuration(value: string): number;
|
|
42
|
+
//# sourceMappingURL=reports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../../src/cli/reports.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU5D,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IACnF,UAAU,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,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from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
const SECRET_PATTERNS = [
|
|
4
|
+
/0x[0-9a-fA-F]{64}(?![0-9a-fA-F])/gu, // private keys, salts
|
|
5
|
+
/\bagt_[A-Za-z0-9_-]{8,}/gu, // agent API keys
|
|
6
|
+
/\bags_[A-Za-z0-9_-]{8,}/gu, // SIWE session tokens
|
|
7
|
+
/\bBearer\s+[A-Za-z0-9._-]+/gu,
|
|
8
|
+
/\b(?:[a-z]{3,8}\s+){11}[a-z]{3,8}\b/gu, // 12+ word phrases (mnemonics)
|
|
9
|
+
];
|
|
10
|
+
/** Remove anything that looks like key material before it reaches a file, webhook or chat. */
|
|
11
|
+
export function sanitize(text) {
|
|
12
|
+
return SECRET_PATTERNS.reduce((current, pattern) => current.replace(pattern, "[redacted]"), text);
|
|
13
|
+
}
|
|
14
|
+
const COUNTED = {
|
|
15
|
+
delivery_signed: "deliveries",
|
|
16
|
+
report_submitted: "testReports",
|
|
17
|
+
vote_committed: "votes",
|
|
18
|
+
};
|
|
19
|
+
/** Fold the tick reports of one period into a summary. */
|
|
20
|
+
export function summarize(role, ticks, extra) {
|
|
21
|
+
const counts = { claims: 0, deliveries: 0, testReports: 0, votes: 0 };
|
|
22
|
+
const waiting = new Set();
|
|
23
|
+
const progress = new Map();
|
|
24
|
+
const risks = new Set();
|
|
25
|
+
for (const tick of ticks) {
|
|
26
|
+
for (const event of tick.events) {
|
|
27
|
+
const key = COUNTED[event.type];
|
|
28
|
+
if (key)
|
|
29
|
+
counts[key] += 1;
|
|
30
|
+
if (event.type === "deadline_warning" || event.type === "tx_failed")
|
|
31
|
+
risks.add(`${event.type}: ${event.detail}`);
|
|
32
|
+
}
|
|
33
|
+
for (const handled of tick.handled) {
|
|
34
|
+
const label = `${handled.kind} ${handled.subjectId}`;
|
|
35
|
+
if (handled.kind === "CLAIM_HEARTBEAT")
|
|
36
|
+
counts.claims = Math.max(counts.claims, 1);
|
|
37
|
+
if (handled.outcome === "pending-tx")
|
|
38
|
+
waiting.add(label);
|
|
39
|
+
else if (handled.outcome !== "done")
|
|
40
|
+
progress.set(label, null);
|
|
41
|
+
}
|
|
42
|
+
for (const warning of tick.warnings)
|
|
43
|
+
risks.add(warning);
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
role,
|
|
47
|
+
at: new Date().toISOString(),
|
|
48
|
+
counts,
|
|
49
|
+
inProgress: [...progress].map(([item, deadline]) => ({ item, deadline })),
|
|
50
|
+
waitingForUser: [...waiting],
|
|
51
|
+
risks: [...risks],
|
|
52
|
+
...extra,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function formatReport(summary) {
|
|
56
|
+
const progress = summary.inProgress
|
|
57
|
+
.map((entry) => `${entry.item}${entry.deadline ? ` — due ${entry.deadline}` : ""}`)
|
|
58
|
+
.join("; ") || "none";
|
|
59
|
+
return sanitize([
|
|
60
|
+
`agentsgot ${summary.role} report — ${summary.at}`,
|
|
61
|
+
`Online: ${summary.online ? "yes" : "no"} (last heartbeat ${summary.lastHeartbeatAt ?? "never"})`,
|
|
62
|
+
`This period: claims ${summary.counts.claims} · deliveries ${summary.counts.deliveries} · test reports ${summary.counts.testReports} · votes ${summary.counts.votes}`,
|
|
63
|
+
`In progress: ${progress}`,
|
|
64
|
+
`Waiting for you: ${summary.waitingForUser.join("; ") || "nothing"}`,
|
|
65
|
+
`Earnings (AGT): claimed ${summary.earnings.claimedAgt} · claimable ${summary.earnings.claimableAgt} · locked ${summary.earnings.lockedAgt} (v3 vesting 60/25/15 for executors)`,
|
|
66
|
+
`Risks: ${summary.risks.join("; ") || "none"}`,
|
|
67
|
+
`Next report: ${summary.nextReportAt}`,
|
|
68
|
+
].join("\n"));
|
|
69
|
+
}
|
|
70
|
+
function day(date) {
|
|
71
|
+
return date.toISOString().slice(0, 10).replace(/-/gu, "");
|
|
72
|
+
}
|
|
73
|
+
/** Append to <dir>/<role>-YYYYMMDD.md and .jsonl; returns the .md path. */
|
|
74
|
+
export function writeReport(dir, summary) {
|
|
75
|
+
mkdirSync(dir, { recursive: true });
|
|
76
|
+
const base = join(dir, `${summary.role}-${day(new Date(summary.at))}`);
|
|
77
|
+
appendFileSync(`${base}.md`, `${formatReport(summary)}\n\n`);
|
|
78
|
+
appendFileSync(`${base}.jsonl`, `${sanitize(JSON.stringify({ kind: "summary", ...summary }))}\n`);
|
|
79
|
+
return `${base}.md`;
|
|
80
|
+
}
|
|
81
|
+
/** Immediate event line (drawn as tester, deadline warning, tx failed, ...). */
|
|
82
|
+
export function writeEvent(dir, role, event) {
|
|
83
|
+
mkdirSync(dir, { recursive: true });
|
|
84
|
+
const at = new Date();
|
|
85
|
+
appendFileSync(join(dir, `${role}-${day(at)}.jsonl`), `${sanitize(JSON.stringify({ kind: "event", at: at.toISOString(), ...event }))}\n`);
|
|
86
|
+
}
|
|
87
|
+
/** Read summaries and events newer than `sinceMs` for `agentsgot report`. */
|
|
88
|
+
export function readReports(dir, sinceMs, role) {
|
|
89
|
+
if (!existsSync(dir))
|
|
90
|
+
return [];
|
|
91
|
+
const cutoff = Date.now() - sinceMs;
|
|
92
|
+
const rows = [];
|
|
93
|
+
const files = readdirSync(dir)
|
|
94
|
+
.filter((name) => name.endsWith(".jsonl") && (!role || name.startsWith(`${role}-`)))
|
|
95
|
+
.sort();
|
|
96
|
+
for (const file of files)
|
|
97
|
+
for (const line of readFileSync(join(dir, file), "utf8").split("\n")) {
|
|
98
|
+
if (!line.trim())
|
|
99
|
+
continue;
|
|
100
|
+
const row = JSON.parse(line);
|
|
101
|
+
if (new Date(row.at).getTime() >= cutoff)
|
|
102
|
+
rows.push(row);
|
|
103
|
+
}
|
|
104
|
+
return rows;
|
|
105
|
+
}
|
|
106
|
+
export async function postWebhook(url, text, fetcher = fetch) {
|
|
107
|
+
await fetcher(url, {
|
|
108
|
+
method: "POST",
|
|
109
|
+
headers: { "content-type": "application/json" },
|
|
110
|
+
body: JSON.stringify({ text: sanitize(text) }),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/** Parse "24h", "30m", "7d", "90s" into milliseconds. */
|
|
114
|
+
export function parseDuration(value) {
|
|
115
|
+
const match = /^(\d+)([smhd])$/u.exec(value.trim());
|
|
116
|
+
if (!match)
|
|
117
|
+
throw new Error(`Invalid duration ${value}; use e.g. 30m, 24h, 7d.`);
|
|
118
|
+
const unit = { s: 1_000, m: 60_000, h: 3_600_000, d: 86_400_000 }[match[2]];
|
|
119
|
+
return Number(match[1]) * unit;
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=reports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reports.js","sourceRoot":"","sources":["../../src/cli/reports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,MAAM,eAAe,GAAa;IAChC,oCAAoC,EAAE,sBAAsB;IAC5D,2BAA2B,EAAE,iBAAiB;IAC9C,2BAA2B,EAAE,sBAAsB;IACnD,8BAA8B;IAC9B,uCAAuC,EAAE,+BAA+B;CACzE,CAAC;AAEF,8FAA8F;AAC9F,MAAM,UAAU,QAAQ,CAAC,IAAY;IACnC,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,EAAE,IAAI,CAAC,CAAC;AACpG,CAAC;AAeD,MAAM,OAAO,GAAwE;IACnF,eAAe,EAAE,YAAY;IAC7B,gBAAgB,EAAE,aAAa;IAC/B,cAAc,EAAE,OAAO;CACxB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,KAA4B,EAC5B,KAAsF;IAEtF,MAAM,MAAM,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE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AO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,GAAW,EAAE,IAAY,EAAE,OAAO,GAAG,KAAK;IAC1E,MAAM,OAAO,CAAC,GAAG,EAAE;QACjB,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC;AAED,yDAAyD;AACzD,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,0BAA0B,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,UAAU,EAAE,CAC/D,KAAK,CAAC,CAAC,CAA0B,CAClC,CAAC;IACF,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Role } from "../roles.js";
|
|
2
|
+
import type { AgentGridClient } from "../sdk/client.js";
|
|
3
|
+
import { type CliContext } from "./context.js";
|
|
4
|
+
export interface RunOptions {
|
|
5
|
+
autoSend: boolean;
|
|
6
|
+
sendTriggers: boolean;
|
|
7
|
+
once: boolean;
|
|
8
|
+
reportInterval?: string;
|
|
9
|
+
webhook?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Sum vesting tranches by status, formatted as AGT. */
|
|
12
|
+
export declare function earnings(client: AgentGridClient): Promise<{
|
|
13
|
+
claimedAgt: string;
|
|
14
|
+
claimableAgt: string;
|
|
15
|
+
lockedAgt: string;
|
|
16
|
+
}>;
|
|
17
|
+
/** `agentsgot run <roles>`: presence + next-actions loop with periodic and event reports. */
|
|
18
|
+
export declare function runCommand(ctx: CliContext, roles: Role[], options: RunOptions): Promise<void>;
|
|
19
|
+
/** `agentsgot report --since 24h [--role r]`. */
|
|
20
|
+
export declare function reportCommand(ctx: CliContext, since?: string, role?: string): void;
|
|
21
|
+
//# sourceMappingURL=run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,KAAK,UAAU,EAA2C,MAAM,cAAc,CAAC;AAcxF,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wDAAwD;AACxD,wBAAsB,QAAQ,CAAC,MAAM,EAAE,eAAe;;;;GAcrD;AAqBD,6FAA6F;AAC7F,wBAAsB,UAAU,CAC9B,GAAG,EAAE,UAAU,EACf,KAAK,EAAE,IAAI,EAAE,EACb,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,IAAI,CAAC,CAgFf;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,SAAQ,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAOjF"}
|
package/dist/cli/run.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { RoleRunner } from "../runner.js";
|
|
2
|
+
import { effectiveInterval, mergedSchedules } from "../schedules.js";
|
|
3
|
+
import { err, out } from "./commands.js";
|
|
4
|
+
import { checkpointStore, clientFor, loadAccount } from "./context.js";
|
|
5
|
+
import { formatAgt } from "./doctor.js";
|
|
6
|
+
import { homePaths, loadConfig } from "./home.js";
|
|
7
|
+
import { formatReport, parseDuration, postWebhook, readReports, sanitize, summarize, writeEvent, writeReport, } from "./reports.js";
|
|
8
|
+
/** Sum vesting tranches by status, formatted as AGT. */
|
|
9
|
+
export async function earnings(client) {
|
|
10
|
+
const totals = { CLAIMED: 0n, CLAIMABLE: 0n, LOCKED: 0n };
|
|
11
|
+
try {
|
|
12
|
+
for (const item of (await client.listRewards()).items)
|
|
13
|
+
if (item.status in totals)
|
|
14
|
+
totals[item.status] = (totals[item.status] ?? 0n) + BigInt(item.amount);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
// Rewards are informational in reports; ignore transient failures.
|
|
18
|
+
}
|
|
19
|
+
return {
|
|
20
|
+
claimedAgt: formatAgt(totals.CLAIMED ?? 0n),
|
|
21
|
+
claimableAgt: formatAgt(totals.CLAIMABLE ?? 0n),
|
|
22
|
+
lockedAgt: formatAgt(totals.LOCKED ?? 0n),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function printTick(tick) {
|
|
26
|
+
for (const handled of tick.handled) {
|
|
27
|
+
if (handled.outcome !== "skipped")
|
|
28
|
+
err(sanitize(`[${tick.asOf}] ${handled.kind} ${handled.subjectId}: ${handled.outcome} - ${handled.detail}`));
|
|
29
|
+
if (handled.pendingTx)
|
|
30
|
+
out(sanitize(`Pending transaction for ${handled.kind} ${handled.subjectId} (review and send it yourself, or rerun with --auto-send):\n${JSON.stringify(handled.pendingTx, null, 2)}`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
34
|
+
/** `agentsgot run <roles>`: presence + next-actions loop with periodic and event reports. */
|
|
35
|
+
export async function runCommand(ctx, roles, options) {
|
|
36
|
+
const account = await loadAccount(ctx);
|
|
37
|
+
const { client, hasCredential } = await clientFor(ctx, account);
|
|
38
|
+
if (!hasCredential)
|
|
39
|
+
throw new Error("Not registered. Run `agentsgot doctor --register` first.");
|
|
40
|
+
const reportsDir = homePaths(ctx.home).reports;
|
|
41
|
+
const config = loadConfig(ctx.home);
|
|
42
|
+
const reportSeconds = options.reportInterval
|
|
43
|
+
? parseDuration(options.reportInterval) / 1000
|
|
44
|
+
: (config.reportIntervalSeconds ?? 3600);
|
|
45
|
+
const webhook = options.webhook ?? ctx.env.AGENTSGOT_REPORT_WEBHOOK;
|
|
46
|
+
const schedules = mergedSchedules(roles, { reportIntervalSeconds: reportSeconds });
|
|
47
|
+
const presence = schedules.find((job) => job.name === "presence");
|
|
48
|
+
const poll = schedules.find((job) => job.name === "next-actions");
|
|
49
|
+
const runner = new RoleRunner({
|
|
50
|
+
client,
|
|
51
|
+
roles,
|
|
52
|
+
checkpoints: checkpointStore(ctx, account.address),
|
|
53
|
+
autoSend: options.autoSend,
|
|
54
|
+
sendTriggers: options.sendTriggers,
|
|
55
|
+
});
|
|
56
|
+
const label = roles.join("+");
|
|
57
|
+
if (options.autoSend)
|
|
58
|
+
err("Auto-send is ON: caller-paid transactions are sent from your wallet.");
|
|
59
|
+
err(`Running ${label} as ${account.address}. Jobs: ${schedules.map((job) => job.name).join(", ")}`);
|
|
60
|
+
let lastHeartbeatAt = null;
|
|
61
|
+
let lastPresence = 0;
|
|
62
|
+
let lastReport = Date.now();
|
|
63
|
+
let ticks = [];
|
|
64
|
+
let stopping = false;
|
|
65
|
+
process.once("SIGINT", () => {
|
|
66
|
+
stopping = true;
|
|
67
|
+
});
|
|
68
|
+
const report = async () => {
|
|
69
|
+
const summary = summarize(label, ticks, {
|
|
70
|
+
online: lastHeartbeatAt !== null,
|
|
71
|
+
lastHeartbeatAt,
|
|
72
|
+
earnings: await earnings(client),
|
|
73
|
+
nextReportAt: new Date(Date.now() + reportSeconds * 1000).toISOString(),
|
|
74
|
+
});
|
|
75
|
+
const text = formatReport(summary);
|
|
76
|
+
out(text);
|
|
77
|
+
writeReport(reportsDir, summary);
|
|
78
|
+
if (webhook)
|
|
79
|
+
await postWebhook(webhook, text).catch(() => undefined);
|
|
80
|
+
ticks = [];
|
|
81
|
+
lastReport = Date.now();
|
|
82
|
+
};
|
|
83
|
+
while (!stopping) {
|
|
84
|
+
let expedited = false;
|
|
85
|
+
try {
|
|
86
|
+
if (presence && Date.now() - lastPresence >= presence.everySeconds * 1000) {
|
|
87
|
+
lastHeartbeatAt = (await client.reportPresence()).lastHeartbeatAt;
|
|
88
|
+
lastPresence = Date.now();
|
|
89
|
+
}
|
|
90
|
+
const tick = await runner.tick();
|
|
91
|
+
expedited = tick.expedited;
|
|
92
|
+
ticks.push(tick);
|
|
93
|
+
printTick(tick);
|
|
94
|
+
for (const event of tick.events) {
|
|
95
|
+
writeEvent(reportsDir, label, event);
|
|
96
|
+
const line = sanitize(`agentsgot ${label} event: ${event.type} ${event.subjectId} - ${event.detail}`);
|
|
97
|
+
err(line);
|
|
98
|
+
if (webhook)
|
|
99
|
+
await postWebhook(webhook, line).catch(() => undefined);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
err(sanitize(`tick failed: ${error.message}`));
|
|
104
|
+
}
|
|
105
|
+
if (options.once) {
|
|
106
|
+
await report();
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (Date.now() - lastReport >= reportSeconds * 1000)
|
|
110
|
+
await report();
|
|
111
|
+
await sleep((poll ? effectiveInterval(poll, expedited) : 300) * 1000);
|
|
112
|
+
}
|
|
113
|
+
await report();
|
|
114
|
+
}
|
|
115
|
+
/** `agentsgot report --since 24h [--role r]`. */
|
|
116
|
+
export function reportCommand(ctx, since = "24h", role) {
|
|
117
|
+
const rows = readReports(homePaths(ctx.home).reports, parseDuration(since), role);
|
|
118
|
+
if (rows.length === 0) {
|
|
119
|
+
out(`No reports in the last ${since}.`);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
for (const row of rows)
|
|
123
|
+
out(sanitize(JSON.stringify(row)));
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=run.js.map
|