@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,474 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AcceptanceGrade,
|
|
5
|
+
AllocationMode,
|
|
6
|
+
ArbitrationRound,
|
|
7
|
+
agtToWei,
|
|
8
|
+
allocateByScore,
|
|
9
|
+
allocateExecutorPool,
|
|
10
|
+
antiWashCheck,
|
|
11
|
+
arbitrationPanel,
|
|
12
|
+
checkDraft,
|
|
13
|
+
checkPublisherStake,
|
|
14
|
+
checkSpecContent,
|
|
15
|
+
computeAppealBond,
|
|
16
|
+
computeAppealFee,
|
|
17
|
+
computeArbitratorWeight,
|
|
18
|
+
computeCaseFee,
|
|
19
|
+
computeCaseLock,
|
|
20
|
+
computeCurrentTier,
|
|
21
|
+
computeDeduction,
|
|
22
|
+
computeDisputeBound,
|
|
23
|
+
computeEarliestSubmitSeconds,
|
|
24
|
+
computeEscalationStep,
|
|
25
|
+
computeFinalAppealFee,
|
|
26
|
+
computeMaxDisputeValue,
|
|
27
|
+
computeMinimumTier,
|
|
28
|
+
computeReserve,
|
|
29
|
+
computeTaskDailyEmission,
|
|
30
|
+
computeTesterMissReportSlash,
|
|
31
|
+
computeTierRangeMax,
|
|
32
|
+
defaultParams,
|
|
33
|
+
executorPoolShare,
|
|
34
|
+
formatWeiAsAgt,
|
|
35
|
+
parseAgtToWei,
|
|
36
|
+
qualifiedValidatorRoles,
|
|
37
|
+
resolveParticipantLimit,
|
|
38
|
+
snapshotDailyFees,
|
|
39
|
+
splitCaseFee,
|
|
40
|
+
splitEmission,
|
|
41
|
+
splitOverturnPenalty,
|
|
42
|
+
TaskTemplate,
|
|
43
|
+
Tier,
|
|
44
|
+
UNLIMITED_PARTICIPANTS,
|
|
45
|
+
testerPairDecay,
|
|
46
|
+
testerSeatShare,
|
|
47
|
+
tierBaseQuota,
|
|
48
|
+
tierDailyFee,
|
|
49
|
+
tierSubmissionLimit,
|
|
50
|
+
validatorDrawWeight,
|
|
51
|
+
validatorRoleMinimum,
|
|
52
|
+
vestingSchedule,
|
|
53
|
+
vestingTranches,
|
|
54
|
+
} from "../src/index.js";
|
|
55
|
+
import { criterionA, makeDraft } from "./fixtures.js";
|
|
56
|
+
|
|
57
|
+
/** 1 AGT = 10^18 wei — the scaling factor applied by tierDailyFee. */
|
|
58
|
+
const AGT = 10n ** 18n;
|
|
59
|
+
|
|
60
|
+
describe("tier helpers", () => {
|
|
61
|
+
it("returns daily fees in ascending order", () => {
|
|
62
|
+
const fees = [Tier.T1, Tier.T2, Tier.T3, Tier.T4, Tier.T5].map((t) =>
|
|
63
|
+
tierDailyFee(t, defaultParams),
|
|
64
|
+
);
|
|
65
|
+
for (let i = 1; i < fees.length; i++) expect(fees[i]!).toBeGreaterThan(fees[i - 1]!);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("returns base quotas 3/5/8", () => {
|
|
69
|
+
expect(tierBaseQuota(Tier.T1, defaultParams)).toBe(3);
|
|
70
|
+
expect(tierBaseQuota(Tier.T2, defaultParams)).toBe(5);
|
|
71
|
+
expect(tierBaseQuota(Tier.T3, defaultParams)).toBe(8);
|
|
72
|
+
expect(tierBaseQuota(Tier.T4, defaultParams)).toBe(8);
|
|
73
|
+
expect(tierBaseQuota(Tier.T5, defaultParams)).toBe(8);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("returns submission limits = 3N", () => {
|
|
77
|
+
expect(tierSubmissionLimit(Tier.T1, defaultParams)).toBe(9);
|
|
78
|
+
expect(tierSubmissionLimit(Tier.T2, defaultParams)).toBe(15);
|
|
79
|
+
expect(tierSubmissionLimit(Tier.T3, defaultParams)).toBe(24);
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe("minimum tier and range", () => {
|
|
84
|
+
it.each([
|
|
85
|
+
[1, TaskTemplate.Translation, Tier.T1],
|
|
86
|
+
[1, TaskTemplate.Research, Tier.T2],
|
|
87
|
+
[1, TaskTemplate.CodeFix, Tier.T3],
|
|
88
|
+
[6.01, TaskTemplate.Translation, Tier.T3],
|
|
89
|
+
[72.01, TaskTemplate.Translation, Tier.T4],
|
|
90
|
+
[169, TaskTemplate.Translation, Tier.T5],
|
|
91
|
+
] as const)("maps hours=%s template=%s to %s", (hours, template, expected) => {
|
|
92
|
+
expect(
|
|
93
|
+
computeMinimumTier({
|
|
94
|
+
criteria: [criterionA],
|
|
95
|
+
estimatedHours: hours,
|
|
96
|
+
template,
|
|
97
|
+
}),
|
|
98
|
+
).toBe(expected);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("maps C-grade criteria > 30% to T3", () => {
|
|
102
|
+
expect(
|
|
103
|
+
computeMinimumTier({
|
|
104
|
+
criteria: [
|
|
105
|
+
{ ...criterionA, grade: AcceptanceGrade.C, weightBps: 4_000, machineCheck: undefined },
|
|
106
|
+
{ ...criterionA, id: "a2", weightBps: 6_000 },
|
|
107
|
+
],
|
|
108
|
+
estimatedHours: 1,
|
|
109
|
+
template: TaskTemplate.Translation,
|
|
110
|
+
}),
|
|
111
|
+
).toBe(Tier.T3);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it("computes range max = min(minimum + offset, 5)", () => {
|
|
115
|
+
expect(computeTierRangeMax(Tier.T1, defaultParams)).toBe(Tier.T3);
|
|
116
|
+
expect(computeTierRangeMax(Tier.T3, defaultParams)).toBe(Tier.T5);
|
|
117
|
+
expect(computeTierRangeMax(Tier.T4, defaultParams)).toBe(Tier.T5);
|
|
118
|
+
expect(computeTierRangeMax(Tier.T5, defaultParams)).toBe(Tier.T5);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe("reserve and deduction", () => {
|
|
123
|
+
it("computes reserve = F_max × D", () => {
|
|
124
|
+
expect(computeReserve(Tier.T3, 10, defaultParams)).toBe(200_000n * AGT);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("computes deduction = F_t × seconds / 86400", () => {
|
|
128
|
+
expect(computeDeduction(Tier.T1, 86400n, defaultParams)).toBe(300n * AGT);
|
|
129
|
+
expect(computeDeduction(Tier.T2, 43200n, defaultParams)).toBe(1000n * AGT);
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe("participant limit", () => {
|
|
135
|
+
it("treats 0 as unlimited and accepts large custom caps", () => {
|
|
136
|
+
expect(resolveParticipantLimit(UNLIMITED_PARTICIPANTS, defaultParams)).toBeNull();
|
|
137
|
+
expect(resolveParticipantLimit(500, defaultParams)).toBe(500);
|
|
138
|
+
expect(resolveParticipantLimit(undefined, defaultParams)).toBe(9);
|
|
139
|
+
expect(() => resolveParticipantLimit(65_536, defaultParams)).toThrow(RangeError);
|
|
140
|
+
expect(() => resolveParticipantLimit(1.5, defaultParams)).toThrow(RangeError);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe("allocation", () => {
|
|
145
|
+
it("winner-takes-all gives pool to highest scorer", () => {
|
|
146
|
+
const result = allocateExecutorPool(
|
|
147
|
+
1000n,
|
|
148
|
+
[
|
|
149
|
+
{ submissionIndex: 1, score: 80, passes: true },
|
|
150
|
+
{ submissionIndex: 2, score: 90, passes: true },
|
|
151
|
+
],
|
|
152
|
+
AllocationMode.WinnerTakesAll,
|
|
153
|
+
);
|
|
154
|
+
expect(result).toHaveLength(1);
|
|
155
|
+
expect(result[0]!.submissionIndex).toBe(2);
|
|
156
|
+
expect(result[0]!.amount).toBe(1000n);
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
it("top-K splits equally among top K", () => {
|
|
160
|
+
const result = allocateExecutorPool(
|
|
161
|
+
1000n,
|
|
162
|
+
[
|
|
163
|
+
{ submissionIndex: 1, score: 90, passes: true },
|
|
164
|
+
{ submissionIndex: 2, score: 80, passes: true },
|
|
165
|
+
{ submissionIndex: 3, score: 70, passes: true },
|
|
166
|
+
],
|
|
167
|
+
AllocationMode.TopK,
|
|
168
|
+
2,
|
|
169
|
+
);
|
|
170
|
+
expect(result).toHaveLength(2);
|
|
171
|
+
const total = result.reduce((sum, r) => sum + r.amount, 0n);
|
|
172
|
+
expect(total).toBe(1000n);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("pro-rata splits by score proportion", () => {
|
|
176
|
+
const result = allocateExecutorPool(
|
|
177
|
+
1000n,
|
|
178
|
+
[
|
|
179
|
+
{ submissionIndex: 1, score: 75, passes: true },
|
|
180
|
+
{ submissionIndex: 2, score: 25, passes: true },
|
|
181
|
+
],
|
|
182
|
+
AllocationMode.ProRata,
|
|
183
|
+
);
|
|
184
|
+
expect(result).toHaveLength(2);
|
|
185
|
+
const total = result.reduce((sum, r) => sum + r.amount, 0n);
|
|
186
|
+
expect(total).toBe(1000n);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it("returns empty when no one passes", () => {
|
|
190
|
+
const result = allocateExecutorPool(
|
|
191
|
+
1000n,
|
|
192
|
+
[{ submissionIndex: 1, score: 30, passes: false }],
|
|
193
|
+
AllocationMode.WinnerTakesAll,
|
|
194
|
+
);
|
|
195
|
+
expect(result).toHaveLength(0);
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
describe("vesting", () => {
|
|
200
|
+
it("creates 3 vesting tranches at 60/25/15%", () => {
|
|
201
|
+
const schedule = vestingSchedule(100n, 1_000, defaultParams);
|
|
202
|
+
expect(schedule).toHaveLength(3);
|
|
203
|
+
expect(schedule[0]!.amount).toBe(60n);
|
|
204
|
+
expect(schedule[1]!.amount).toBe(25n);
|
|
205
|
+
expect(schedule[2]!.amount).toBe(15n);
|
|
206
|
+
expect(schedule.reduce((sum, t) => sum + t.amount, 0n)).toBe(100n);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
describe("emission", () => {
|
|
211
|
+
it("per-task emission is capped by ρ·u·C_i", () => {
|
|
212
|
+
const result = computeTaskDailyEmission(300n, 10_000n, 500n, 0n, 300n, defaultParams);
|
|
213
|
+
expect(result.taskEmission).toBeGreaterThanOrEqual(0n);
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
describe("escalation and timing", () => {
|
|
218
|
+
it("computes escalation step = max(6h, 10%·D)", () => {
|
|
219
|
+
const step = computeEscalationStep(10, defaultParams);
|
|
220
|
+
expect(step).toBe(24 * 3600);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it("escalates tier from T1 towards maxTier", () => {
|
|
224
|
+
const step = computeEscalationStep(3, defaultParams);
|
|
225
|
+
expect(computeCurrentTier(Tier.T1, Tier.T3, 0, step + 1, step)).toBe(Tier.T2);
|
|
226
|
+
expect(computeCurrentTier(Tier.T1, Tier.T3, 0, step * 3, step)).toBe(Tier.T3);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it("computes earliest submit time", () => {
|
|
230
|
+
const seconds = computeEarliestSubmitSeconds(10, defaultParams);
|
|
231
|
+
expect(seconds).toBe(24 * 3600);
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe("staking", () => {
|
|
236
|
+
it("uses fixed role thresholds", () => {
|
|
237
|
+
expect(validatorRoleMinimum("TESTER", defaultParams)).toBe(agtToWei(20_000));
|
|
238
|
+
expect(validatorRoleMinimum("ARBITRATOR", defaultParams)).toBe(agtToWei(1_000_000));
|
|
239
|
+
expect(qualifiedValidatorRoles(agtToWei(19_999), defaultParams)).toEqual([]);
|
|
240
|
+
expect(qualifiedValidatorRoles(agtToWei(20_000), defaultParams)).toEqual(["TESTER"]);
|
|
241
|
+
expect(qualifiedValidatorRoles(agtToWei(1_000_000), defaultParams)).toEqual([
|
|
242
|
+
"TESTER",
|
|
243
|
+
"ARBITRATOR",
|
|
244
|
+
]);
|
|
245
|
+
});
|
|
246
|
+
|
|
247
|
+
it("caps linear draw weight per role", () => {
|
|
248
|
+
expect(validatorDrawWeight(agtToWei(150_000), "TESTER", defaultParams)).toBe(agtToWei(150_000));
|
|
249
|
+
expect(validatorDrawWeight(agtToWei(500_000), "TESTER", defaultParams)).toBe(agtToWei(200_000));
|
|
250
|
+
expect(validatorDrawWeight(agtToWei(3_000_000), "ARBITRATOR", defaultParams)).toBe(
|
|
251
|
+
agtToWei(3_000_000),
|
|
252
|
+
);
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it("caps the tester missed-report slash by reward multiple and stake share", () => {
|
|
256
|
+
const multiple = BigInt(defaultParams.testerMissReportSlashMultiple);
|
|
257
|
+
const byReward = computeTesterMissReportSlash(agtToWei(10), agtToWei(1_000_000), defaultParams);
|
|
258
|
+
expect(byReward).toBe(agtToWei(10) * multiple);
|
|
259
|
+
const stake = agtToWei(20_000);
|
|
260
|
+
const byStake = computeTesterMissReportSlash(agtToWei(1_000_000), stake, defaultParams);
|
|
261
|
+
expect(byStake).toBe((stake * BigInt(defaultParams.testerSlashStakeCapBps)) / 10_000n);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it("checks publisher stake as base wei plus rounded-up exposure", () => {
|
|
265
|
+
const result = checkPublisherStake(
|
|
266
|
+
{ actualStake: agtToWei(30), inFlightReserves: agtToWei(55), nextReserve: agtToWei(25) },
|
|
267
|
+
defaultParams,
|
|
268
|
+
);
|
|
269
|
+
expect(result.required).toBe(agtToWei(25));
|
|
270
|
+
expect(result.ok).toBe(true);
|
|
271
|
+
const small = checkPublisherStake(
|
|
272
|
+
{ actualStake: parseAgtToWei("0.6"), inFlightReserves: 0n, nextReserve: 1n },
|
|
273
|
+
defaultParams,
|
|
274
|
+
);
|
|
275
|
+
expect(small.required).toBe(agtToWei(10) + 1n);
|
|
276
|
+
expect(small.ok).toBe(false);
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
describe("AGT units", () => {
|
|
281
|
+
it("converts decimal AGT to wei without floating point drift", () => {
|
|
282
|
+
expect(agtToWei(0.5)).toBe(500_000_000_000_000_000n);
|
|
283
|
+
expect(agtToWei(0.1)).toBe(100_000_000_000_000_000n);
|
|
284
|
+
expect(agtToWei(1e-7)).toBe(100_000_000_000n);
|
|
285
|
+
expect(parseAgtToWei("0.6")).toBe(600_000_000_000_000_000n);
|
|
286
|
+
expect(parseAgtToWei("12.000000000000000001")).toBe(12_000_000_000_000_000_001n);
|
|
287
|
+
expect(() => parseAgtToWei("1.0000000000000000001")).toThrow(RangeError);
|
|
288
|
+
expect(() => parseAgtToWei("-1")).toThrow(RangeError);
|
|
289
|
+
expect(formatWeiAsAgt(600_000_000_000_000_000n)).toBe("0.6");
|
|
290
|
+
expect(formatWeiAsAgt(agtToWei(2000))).toBe("2000");
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
it("prices disputes in wei from AGT minimums", () => {
|
|
294
|
+
expect(computeCaseFee(agtToWei(100), defaultParams)).toBe(agtToWei(6));
|
|
295
|
+
expect(computeCaseFee(agtToWei(1_000), defaultParams)).toBe(agtToWei(50));
|
|
296
|
+
expect(computeAppealBond(agtToWei(6), defaultParams)).toBe(agtToWei(12));
|
|
297
|
+
expect(computeCaseLock(agtToWei(10), agtToWei(1_000), defaultParams)).toBe(agtToWei(50));
|
|
298
|
+
expect(computeCaseLock(agtToWei(10), agtToWei(100), defaultParams)).toBe(agtToWei(10));
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("uses a task's daily fee snapshot over current parameters", () => {
|
|
302
|
+
const fees = { ...snapshotDailyFees(defaultParams), [Tier.T1]: agtToWei(1) };
|
|
303
|
+
expect(computeDeduction(Tier.T1, 86_400n, defaultParams, fees)).toBe(agtToWei(1));
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
describe("arbitration", () => {
|
|
308
|
+
it.each([
|
|
309
|
+
[17, ArbitrationRound.First, false, 0],
|
|
310
|
+
[18, ArbitrationRound.First, true, 5],
|
|
311
|
+
[39, ArbitrationRound.Final, true, 9],
|
|
312
|
+
[40, ArbitrationRound.First, true, 11],
|
|
313
|
+
[40, ArbitrationRound.Final, true, 21],
|
|
314
|
+
])("selects panel for N_arb=%s round=%s", (count, round, enabled, panelSize) => {
|
|
315
|
+
expect(arbitrationPanel(count, round, defaultParams)).toMatchObject({
|
|
316
|
+
enabled,
|
|
317
|
+
panelSize,
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
it("splits case fee 70/20/10 with the remainder to the platform", () => {
|
|
322
|
+
expect(splitCaseFee(100n, defaultParams)).toEqual({ majority: 70n, winner: 20n, platform: 10n });
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
it("splits an overturn penalty: challenger capped by Z, rest 30% platform / 70% righteous", () => {
|
|
326
|
+
const caseFee = agtToWei(6);
|
|
327
|
+
const perSeat = (caseFee * 7_000n) / 10_000n / 9n;
|
|
328
|
+
const challenger = perSeat * 10n;
|
|
329
|
+
const split = splitOverturnPenalty(agtToWei(25), caseFee, 9, defaultParams);
|
|
330
|
+
expect(split.challenger).toBe(challenger);
|
|
331
|
+
expect(split.platform).toBe(((agtToWei(25) - challenger) * 3_000n) / 10_000n);
|
|
332
|
+
expect(split.challenger + split.platform + split.righteous).toBe(agtToWei(25));
|
|
333
|
+
expect(splitOverturnPenalty(1n, caseFee, 9, defaultParams)).toEqual({
|
|
334
|
+
challenger: 1n,
|
|
335
|
+
platform: 0n,
|
|
336
|
+
righteous: 0n,
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it("bounds publishable disputes by arbitration capacity", () => {
|
|
341
|
+
expect(computeDisputeBound(agtToWei(1_000), defaultParams)).toBe(agtToWei(650));
|
|
342
|
+
expect(computeMaxDisputeValue({ eligibleArbitrators: 17, fullScale: false }, defaultParams)).toBe(
|
|
343
|
+
agtToWei(12_000),
|
|
344
|
+
);
|
|
345
|
+
expect(computeMaxDisputeValue({ eligibleArbitrators: 18, fullScale: false }, defaultParams)).toBe(
|
|
346
|
+
agtToWei(1_500_000),
|
|
347
|
+
);
|
|
348
|
+
expect(computeMaxDisputeValue({ eligibleArbitrators: 40, fullScale: true }, defaultParams)).toBe(
|
|
349
|
+
agtToWei(3_300_000),
|
|
350
|
+
);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
it("returns tester pair decay rates", () => {
|
|
354
|
+
expect(testerPairDecay(1, defaultParams)).toBe(10_000);
|
|
355
|
+
expect(testerPairDecay(3, defaultParams)).toBe(4_000);
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
describe("anti-wash", () => {
|
|
360
|
+
it("confirms emission < unrecoverable cost", () => {
|
|
361
|
+
const result = antiWashCheck(defaultParams);
|
|
362
|
+
expect(result.ok).toBe(true);
|
|
363
|
+
expect(result.maxEmissionBps).toBeLessThan(result.unrecoverableBps);
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
describe("economic model v3", () => {
|
|
368
|
+
it("splits emission into 10/65/15/10", () => {
|
|
369
|
+
const amount = 800_000n * AGT;
|
|
370
|
+
const split = splitEmission(amount, defaultParams);
|
|
371
|
+
expect(split.platform + split.executor + split.tester + split.arbitrator).toBe(amount);
|
|
372
|
+
expect(split.platform).toBe(80_000n * AGT);
|
|
373
|
+
expect(split.executor).toBe(520_000n * AGT);
|
|
374
|
+
expect(split.tester).toBe(120_000n * AGT);
|
|
375
|
+
expect(split.arbitrator).toBe(80_000n * AGT);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it("computes appeal fee with tier cap", () => {
|
|
379
|
+
expect(computeAppealFee(Tier.T1, defaultParams)).toBe(15n * AGT);
|
|
380
|
+
expect(computeAppealFee(Tier.T2, defaultParams)).toBe(100n * AGT);
|
|
381
|
+
expect(computeAppealFee(Tier.T3, defaultParams)).toBe(1000n * AGT);
|
|
382
|
+
expect(computeAppealFee(Tier.T4, defaultParams)).toBe(2000n * AGT);
|
|
383
|
+
expect(computeAppealFee(Tier.T5, defaultParams)).toBe(2000n * AGT);
|
|
384
|
+
expect(computeFinalAppealFee(Tier.T1, defaultParams)).toBe(30n * AGT);
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
it("allocates by score with largest remainder conservation", () => {
|
|
388
|
+
const pool = 1000n;
|
|
389
|
+
const results = allocateByScore(pool, [
|
|
390
|
+
{ submissionIndex: 0, score: 60, rewardEligible: true },
|
|
391
|
+
{ submissionIndex: 1, score: 40, rewardEligible: true },
|
|
392
|
+
{ submissionIndex: 2, score: 90, rewardEligible: false },
|
|
393
|
+
]);
|
|
394
|
+
expect(results.reduce((sum, row) => sum + row.amount, 0n)).toBe(pool);
|
|
395
|
+
expect(results.map(({ submissionIndex }) => submissionIndex)).toEqual([0, 1]);
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
it("accrues executor and tester hour shares proportional to fees", () => {
|
|
399
|
+
const hourExec = 650n * AGT;
|
|
400
|
+
const hourTest = 150n * AGT;
|
|
401
|
+
const feeA = 300n * AGT;
|
|
402
|
+
const feeB = 700n * AGT;
|
|
403
|
+
expect(executorPoolShare(hourExec, feeA, feeA + feeB)).toBe((hourExec * feeA) / (feeA + feeB));
|
|
404
|
+
expect(testerSeatShare(hourTest, feeB, feeA + feeB)).toBe((hourTest * feeB) / (feeA + feeB));
|
|
405
|
+
expect(executorPoolShare(hourExec, feeA, 0n)).toBe(0n);
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
it("builds vesting tranches matching 60/25/15", () => {
|
|
409
|
+
const amount = 1000n * AGT;
|
|
410
|
+
const t0 = 1_700_000_000;
|
|
411
|
+
const tranches = vestingTranches(amount, t0, defaultParams);
|
|
412
|
+
expect(tranches).toHaveLength(3);
|
|
413
|
+
expect(tranches.reduce((sum, row) => sum + row.amount, 0n)).toBe(amount);
|
|
414
|
+
expect(tranches[0]!.amount).toBe(600n * AGT);
|
|
415
|
+
expect(tranches[1]!.amount).toBe(250n * AGT);
|
|
416
|
+
expect(tranches[2]!.amount).toBe(150n * AGT);
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
it("computes arbitrator weight with seat bonuses", () => {
|
|
420
|
+
const stake = agtToWei(1_000_000);
|
|
421
|
+
const weight = computeArbitratorWeight(stake, 10_000, [{ tier: Tier.T3 }], defaultParams);
|
|
422
|
+
const bonus = (agtToWei(1_000_000) * 1000n) / 10_000n;
|
|
423
|
+
expect(weight).toBe(stake + bonus);
|
|
424
|
+
});
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
describe("draft checks", () => {
|
|
428
|
+
it("passes a valid draft", () => {
|
|
429
|
+
const results = checkDraft(makeDraft(), defaultParams);
|
|
430
|
+
const blockers = results.filter(({ level }) => level === "block");
|
|
431
|
+
expect(blockers).toEqual([]);
|
|
432
|
+
expect(results.length).toBeGreaterThanOrEqual(6);
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
it("blocks machine checks testers cannot run", () => {
|
|
436
|
+
const draft = makeDraft();
|
|
437
|
+
const [criterion] = draft.fields.criteria.value ?? [];
|
|
438
|
+
if (!criterion?.value) throw new Error("fixture has a criterion");
|
|
439
|
+
criterion.value = {
|
|
440
|
+
...criterion.value,
|
|
441
|
+
machineCheck: { kind: "COMMAND", commandOrSchema: "pnpm test", expected: "exit 0" },
|
|
442
|
+
};
|
|
443
|
+
const check = checkDraft(draft, defaultParams).find(
|
|
444
|
+
({ id }) => id === "criteria.machineChecks",
|
|
445
|
+
);
|
|
446
|
+
expect(check).toMatchObject({ level: "block", fields: ["criteria"] });
|
|
447
|
+
expect(check?.params?.problems).toContain("unsupported kind COMMAND");
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
it("blocks placeholders", () => {
|
|
451
|
+
const draft = makeDraft();
|
|
452
|
+
draft.fields.inputs.value = [{ kind: "TEXT", ref: "请补充:1)交易日 2)行情数据" }];
|
|
453
|
+
draft.fields.summary.value = "生成 {{date}} 的美股日报";
|
|
454
|
+
const check = checkDraft(draft, defaultParams).find(({ id }) => id === "content.placeholders");
|
|
455
|
+
expect(check).toMatchObject({ level: "block" });
|
|
456
|
+
expect(check?.fields).toEqual(expect.arrayContaining(["inputs", "summary"]));
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
it("blocks invalid run days", () => {
|
|
460
|
+
const draft = makeDraft();
|
|
461
|
+
draft.fields.runDays.value = 100;
|
|
462
|
+
const results = checkDraft(draft, defaultParams);
|
|
463
|
+
const check = results.find(({ id }) => id === "runDays.range");
|
|
464
|
+
expect(check?.level).toBe("block");
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
it("blocks stale cost", () => {
|
|
468
|
+
const draft = makeDraft();
|
|
469
|
+
draft.fields.cost.value = { reserve: "999999", dailyFee: "1" };
|
|
470
|
+
const results = checkDraft(draft, defaultParams);
|
|
471
|
+
const check = results.find(({ id }) => id === "cost.computed");
|
|
472
|
+
expect(check?.level).toBe("block");
|
|
473
|
+
});
|
|
474
|
+
});
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AcceptanceGrade,
|
|
5
|
+
AcceptanceGradeSchema,
|
|
6
|
+
AllocationMode,
|
|
7
|
+
AllocationModeSchema,
|
|
8
|
+
ArbitrationRound,
|
|
9
|
+
ArbitrationRoundSchema,
|
|
10
|
+
CriterionSchema,
|
|
11
|
+
EmissionDaySchema,
|
|
12
|
+
finalizeDraft,
|
|
13
|
+
Role,
|
|
14
|
+
RoleSchema,
|
|
15
|
+
TaskSpecSchema,
|
|
16
|
+
TaskStatus,
|
|
17
|
+
TaskStatusSchema,
|
|
18
|
+
TaskTemplate,
|
|
19
|
+
TaskTemplateSchema,
|
|
20
|
+
Tier,
|
|
21
|
+
TierSchema,
|
|
22
|
+
ValidatorStatus,
|
|
23
|
+
ValidatorStatusSchema,
|
|
24
|
+
} from "../src/index.js";
|
|
25
|
+
import { criterionA, makeDraft } from "./fixtures.js";
|
|
26
|
+
|
|
27
|
+
const enumCases = [
|
|
28
|
+
[RoleSchema, Role],
|
|
29
|
+
[TierSchema, Tier],
|
|
30
|
+
[AcceptanceGradeSchema, AcceptanceGrade],
|
|
31
|
+
[AllocationModeSchema, AllocationMode],
|
|
32
|
+
[TaskTemplateSchema, TaskTemplate],
|
|
33
|
+
[TaskStatusSchema, TaskStatus],
|
|
34
|
+
[ValidatorStatusSchema, ValidatorStatus],
|
|
35
|
+
[ArbitrationRoundSchema, ArbitrationRound],
|
|
36
|
+
] as const;
|
|
37
|
+
|
|
38
|
+
describe("serialized enums", () => {
|
|
39
|
+
it.each(enumCases.map(([schema, values], index) => [index, schema, values] as const))(
|
|
40
|
+
"accepts every member of enum %s",
|
|
41
|
+
(_index, schema, values) => {
|
|
42
|
+
for (const value of Object.values(values)) expect(schema.parse(value)).toBe(value);
|
|
43
|
+
},
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
it.each(enumCases.map(([schema], index) => [index, schema] as const))(
|
|
47
|
+
"rejects a non-member of enum %s",
|
|
48
|
+
(_index, schema) => {
|
|
49
|
+
expect(schema.safeParse("not_a_member").success).toBe(false);
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
describe("domain schemas", () => {
|
|
55
|
+
it("requires machine checks for grade A", () => {
|
|
56
|
+
expect(CriterionSchema.safeParse({ ...criterionA, machineCheck: undefined }).success).toBe(
|
|
57
|
+
false,
|
|
58
|
+
);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("allows a subjective grade C criterion", () => {
|
|
62
|
+
expect(
|
|
63
|
+
CriterionSchema.safeParse({ ...criterionA, grade: "C", machineCheck: undefined }).success,
|
|
64
|
+
).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("rejects criterion weights that do not total 10000", () => {
|
|
68
|
+
const spec = finalizeDraft(makeDraft());
|
|
69
|
+
expect(
|
|
70
|
+
TaskSpecSchema.safeParse({ ...spec, criteria: [{ ...criterionA, weightBps: 9_999 }] })
|
|
71
|
+
.success,
|
|
72
|
+
).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("rejects duplicate criterion IDs", () => {
|
|
76
|
+
const spec = finalizeDraft(makeDraft());
|
|
77
|
+
expect(
|
|
78
|
+
TaskSpecSchema.safeParse({
|
|
79
|
+
...spec,
|
|
80
|
+
criteria: [
|
|
81
|
+
{ ...criterionA, weightBps: 5_000 },
|
|
82
|
+
{ ...criterionA, weightBps: 5_000 },
|
|
83
|
+
],
|
|
84
|
+
}).success,
|
|
85
|
+
).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("finalizes a fully confirmed draft", () => {
|
|
89
|
+
expect(finalizeDraft(makeDraft()).version).toBe("AGENTGRID_TASK_SPEC_V4");
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("refuses an unconfirmed field", () => {
|
|
93
|
+
const draft = makeDraft();
|
|
94
|
+
draft.fields.runDays.confirmation = "unconfirmed";
|
|
95
|
+
expect(() => finalizeDraft(draft)).toThrow(/runDays/u);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it("refuses an individually unconfirmed criterion", () => {
|
|
99
|
+
const draft = makeDraft();
|
|
100
|
+
const firstCriterion = draft.fields.criteria.value?.[0];
|
|
101
|
+
if (firstCriterion === undefined) throw new Error("fixture criterion is missing");
|
|
102
|
+
firstCriterion.confirmation = "suggested";
|
|
103
|
+
expect(() => finalizeDraft(draft)).toThrow(/criteria/u);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("refuses a system field not sourced from rules", () => {
|
|
107
|
+
const draft = makeDraft();
|
|
108
|
+
draft.fields.minimumTier.source = "ai";
|
|
109
|
+
expect(() => finalizeDraft(draft)).toThrow(/minimumTier/u);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("parses an emission day", () => {
|
|
113
|
+
expect(
|
|
114
|
+
EmissionDaySchema.parse({
|
|
115
|
+
epoch: 21_915,
|
|
116
|
+
treasuryBalance: "800000000",
|
|
117
|
+
dailyEmission: "600000",
|
|
118
|
+
platformAmount: "60000",
|
|
119
|
+
executorAmount: "390000",
|
|
120
|
+
testerAmount: "90000",
|
|
121
|
+
arbitratorAmount: "60000",
|
|
122
|
+
burnedAmount: "0",
|
|
123
|
+
allocationRoot: `0x${"1".repeat(64)}`,
|
|
124
|
+
totalTaskWeight: "50000",
|
|
125
|
+
activeTaskCount: 42,
|
|
126
|
+
computedAt: "2030-01-01T00:00:00Z",
|
|
127
|
+
}).activeTaskCount,
|
|
128
|
+
).toBe(42);
|
|
129
|
+
});
|
|
130
|
+
});
|